$OpenBSD: patch-buildtools_wafsamba_wafsamba_py,v 1.2 2015/06/17 10:51:08 jca Exp $
Make Samba4 WAF respect OpenBSD shared libraries versioning conventions.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9774
--- buildtools/wafsamba/wafsamba.py.orig	Thu Jun  4 13:43:26 2015
+++ buildtools/wafsamba/wafsamba.py	Thu Jun  4 13:43:26 2015
@@ -194,6 +194,13 @@ def SAMBA_LIBRARY(bld, libname, source,
     deps = TO_LIST(deps)
     deps.append(obj_target)
 
+    osvnum = os.getenv('LIB' + libname.replace('-', '_') + '_VERSION')
+    if osvnum:
+        vnum = osvnum
+        if realname:  realname  = re.sub(r'(\.[0-9]+)+$', '.' + osvnum, realname)
+        if link_name: link_name = re.sub(r'(\.[0-9]+)+$', '.' + osvnum, link_name)
+        if soname:    soname    = re.sub(r'(\.[0-9]+)+$', '.' + osvnum, soname)
+
     realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON'))
     link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON'))
 
